import request from "@/request";
import type {IAdminInfoResponseData, ILoginResponseData, TLoginForm} from "@/api/admin/type.ts";
enum API {
    // 获取验证码
    GET_CODE="/getCode",
    // 验证码登陆
    POST_SYS_ADMIN_LOGIN="/sys/admin/login2",
    // 获取管理员信息 /admin/info
    GET_ADMIN_INFO = "/admin/info"
}
// 获取验证码 /getCode
export const getCode = (w:number=80, h:number=30)=>request.get(API.GET_CODE,{
    params:{
        w,
        h
    }
});
// 实现登陆 /sys/admin/login2
export const postLogin = (body:TLoginForm)=>request.post<any,ILoginResponseData>(API.POST_SYS_ADMIN_LOGIN,body);
// 获取管理员信息
export const getAdminInfo = ()=>request.get<any,IAdminInfoResponseData>(API.GET_ADMIN_INFO)
